<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>注册</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
    <form action="{:url('doRegister')}" method="post">
        <h3>账号注册</h3>
        <div>
            <label for="username">账号</label>
            <input type="text" name="username" id="username">
        </div>
        <div>
            <label for="nickname">昵称</label>
            <input type="text" name="nickname" id="nickname">
        </div>
        <div>
            <label for="password">密码</label>
            <input type="text" name="password" id="password">
        </div>
        <div>
            <label for="rep_password">重复密码</label>
            <input type="text" name="rep_password" id="rep_password">
        </div>
        <input type="submit" value="注册">
    </form>

    <form action="{:url('doQuickRegister')}" method="post">
        <h3>快速注册</h3>
        <div>
            <label for="quick-mobile">手机号</label>
            <input type="text" name="mobile" id="quick-mobile">
        </div>
        <div>
            <label for="quick-code">验证码</label>
            <input type="text" name="code" id="quick-code">
            <button type="button" onclick="sendMobileCode('#quick-mobile')">发送</button>
        </div>
        <input type="submit" value="提交">
    </form>

    <form action="{:url('doMobileRegister')}" method="post">
        <h3>手机号注册</h3>
        <div>
            <label for="mobile">手机号</label>
            <input type="text" name="mobile" id="mobile">
        </div>
        <div>
            <label for="code">验证码</label>
            <input type="text" name="code" id="code">
            <button type="button" onclick="sendMobileCode('#mobile')">发送</button>
        </div>
        <div>
            <label for="password">密码</label>
            <input type="text" name="password" id="password">
        </div>
        <div>
            <label for="rep_password">重复密码</label>
            <input type="text" name="rep_password" id="rep_password">
        </div>
        <input type="submit" value="提交">
    </form>
    <div>
        <a href="{:url('login')}">已有账号，登录</a>
        <a href="{:url('getback')}">找回密码</a>
    </div>
    <div>
        第三方登录
        {foreach name="$outside" item="vo"}
        <a href="{:url($vo.path)}">{$vo.title}</a>
        {/foreach}
    </div>
    <script>
        function sendMobileCode(selector){
            var mobile=$(selector).val();
            if(!mobile){
                alert("手机号不能为空");
                return false;
            }
            $.post("{:url('user/sms/sendRegisterCode')}",{"mobile":mobile},function(data){
                alert(data.msg);
            });
        }
    </script>
</body>
</html>
